<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        table,td{
            height: 100px;
            width: 300px;
            text-align: center;
            border: 1px solid #000;
            border-spacing: 0;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    

    <script>
        var arr = [
     {
       name: '张三',
       age: 18,
       gender: '男'
     },{
       name: '李四',
       age: 20,
       gender: '女'
     },{
       name: '王五',
       age: 22,
       gender: '男'
     }
   ]
   function fn(){
        document.write("<table>");
        for(var i=0;i<arr.length;i++){
            document.write("<tr>");
            for(var key in arr[i]){
            document.write("<td>");
            document.write(arr[i][key]);
            document.write("</td>");
            
            }
            document.write("</tr>");
        }
        document.write("</table>");
        
   }
   fn();
    </script>

</body>
</html>